<template>
  <div class="task-card" @click="$emit('click')">
    <div class="task-title-row">
      <span class="dot"></span>
      <span class="task-title">{{ task.title }}</span>
      <van-icon name="ellipsis" size="20" class="more" v-if="showMore" @click.stop="$emit('more')" />
    </div>
    <div class="task-content">{{ task.content }}</div>
    <div v-if="task.images && task.images.length" class="img-list">
      <img v-for="(img, i) in task.images" :key="i" :src="img" class="img" />
    </div>
    <div class="task-footer">
      <img :src="task.avatar || `https://api.multiavatar.com/${task.author || 'user'}.svg`" class="avatar" @click.stop="$emit('avatar')" />
      <span class="author">{{ task.author }}</span>
      <span class="time">{{ task.time }}</span>
    </div>
  </div>
</template>
<script setup>
const props = defineProps({
  task: Object,
  showMore: Boolean
})
</script>
<style scoped>
.task-card {
  background: #fff;
  border-radius: 14px;
  margin: 0 8px 12px 8px;
  padding: 12px;
  box-shadow: 0 2px 8px 0 rgba(0,0,0,0.06);
}
.task-title-row {
  display: flex;
  align-items: center;
  margin-bottom: 4px;
}
.dot {
  width: 6px;
  height: 6px;
  background: #2ecc71;
  border-radius: 50%;
  margin-right: 6px;
}
.task-title {
  font-weight: bold;
  font-size: 15px;
  flex: 1;
  text-align: left;
  padding: 10px;
}
.more {
  color: #bbb;
}
.task-content {
  color: #666;
  margin-bottom: 6px;
  font-size: 14px;
  line-height: 1.4;
  text-align: left;
  padding: 10px;
  border-radius: 15px;
  background-color: #F6F6F6;
  margin-bottom: 10px;
}
.img-list {
  display: flex;
  gap: 6px;
  margin-bottom: 6px;
}
.img {
  width: 60px;
  height: 60px;
  border-radius: 6px;
  object-fit: cover;
}
.task-footer {
  display: flex;
  align-items: center;
  font-size: 12px;
  color: #888;
  margin-top: 6px;
  justify-content: space-between;
}
.avatar {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  margin-right: 4px;
}
.author {
  margin-right: 6px;
}
</style> 